const TronAPI = {
	triggerContract: async function(contractAddress, contractAbi, methodName, args, feeLimit, callValue) {
		let tronWeb = window.tronWeb
		let myContract = await tronWeb.contract().at(contractAddress)
	
	    var callSend = 'send'
	    contractAbi.forEach(function (val) {
			if (val.name === methodName) {
				callSend = /payable/.test(val.stateMutability) ? 'send' : 'call'
			}
		})
	    return myContract[methodName](...args)[callSend]({
			feeLimit: feeLimit,
			callValue: callValue,
		})
	}
}
export {
  TronAPI
}